package com.ccp.dev.workflow.model;

import org.flowable.engine.impl.persistence.entity.ExecutionEntity;

import java.util.Date;

/**
 * ExecutionImpl的替代类
 * @author jiayueqiao
 */
public class ProcessExecution {

    /**
     * 主键
     */
    private String id;
    /**
     * 数据库更改次数
     */
    private Integer revision;
    /**
     * 流程实例id
     */
    private String processInstanceId;
    /**
     * 业务主键
     */
    private String businessKey;
    /**
     * 流程定义id
     */
    private String processDefinitionId;
    /**
     * 当前活动节点id
     */
    private String activityId;
    /**
     * 是否激活
     */
    private boolean isActive = true;

    private boolean isConcurrent ;
    private boolean isScope = true;
    /**
     * 父id
     */
    private String parentId;

    private String superExecutionId;
    private boolean isEventScope;
    private Integer suspensionState;
    /**
     * 根实例id
     */
    private String rootProcInstId;
    /**
     * 任务数量
     */
    private Integer taskCount;
    /**
     * 创建时间
     */
    private Date startTime;


    public ProcessExecution(){

    }

    /**
     * 根据executionEntity复制excution。
     * @param executionEntity
     */
    public ProcessExecution(ExecutionEntity executionEntity)
    {
        this.revision=executionEntity.getRevision();
        this.processInstanceId=executionEntity.getProcessInstanceId();
        this.businessKey=executionEntity.getBusinessKey();
        this.processDefinitionId=executionEntity.getProcessDefinitionId();
        this.activityId=executionEntity.getActivityId();
        this.isActive=executionEntity.isActive();
        this.isConcurrent=executionEntity.isConcurrent();
        this.isScope=executionEntity.isScope();
        this.parentId=executionEntity.getParentId();
        this.superExecutionId=executionEntity.getSuperExecutionId();
        this.isEventScope=executionEntity.isEventScope();
        this.suspensionState=executionEntity.getSuspensionState();
        this.rootProcInstId = executionEntity.getRootProcessInstanceId();
        this.startTime = new Date();
    }

    public Integer getRevision()
    {
        return revision;
    }

    public void setRevision(Integer revision)
    {
        this.revision = revision;
    }

    public String getProcessInstanceId()
    {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId)
    {
        this.processInstanceId = processInstanceId;
    }

    public String getBusinessKey()
    {
        return businessKey;
    }
    public void setBusinessKey(String businessKey)
    {
        this.businessKey = businessKey;
    }
    public String getParentId()
    {
        return parentId;
    }
    public void setParentId(String parentId)
    {
        this.parentId = parentId;
    }
    public String getProcessDefinitionId()
    {
        return processDefinitionId;
    }
    public void setProcessDefinitionId(String processDefinitionId)
    {
        this.processDefinitionId = processDefinitionId;
    }
    public String getSuperExecutionId()
    {
        return superExecutionId;
    }
    public void setSuperExecutionId(String superExecutionId)
    {
        this.superExecutionId = superExecutionId;
    }
    public String getActivityId()
    {
        return activityId;
    }
    public void setActivityId(String activityId)
    {
        this.activityId = activityId;
    }

    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean active) {
        isActive = active;
    }

    public boolean isConcurrent() {
        return isConcurrent;
    }

    public void setConcurrent(boolean concurrent) {
        isConcurrent = concurrent;
    }

    public boolean isScope() {
        return isScope;
    }

    public void setScope(boolean scope) {
        isScope = scope;
    }

    public boolean isEventScope() {
        return isEventScope;
    }

    public void setEventScope(boolean eventScope) {
        isEventScope = eventScope;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }


    public Integer getSuspensionState() {
        return suspensionState;
    }

    public void setSuspensionState(Integer suspensionState) {
        this.suspensionState = suspensionState;
    }

    public String getRootProcInstId()
    {
        return rootProcInstId;
    }
    public void setRootProcInstId(String rootProcInstId)
    {
        this.rootProcInstId = rootProcInstId;
    }

    public Integer getTaskCount() {
        return taskCount;
    }

    public void setTaskCount(Integer taskCount) {
        this.taskCount = taskCount;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
}
